package com.tianzeculture.stagebao.activity.business;

import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.tianzeculture.stagebao.R;
import com.tianzeculture.stagebao.base.BaseActivity;
import com.tianzeculture.stagebao.bean.PersonnelPoolBean;
import com.tianzeculture.stagebao.net.UserRestUsage;
import com.tianzeculture.stagebao.network.Request;
import com.tianzeculture.stagebao.network.enity.MSG;
import com.tianzeculture.stagebao.network.util.ToastUtil;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/8/12.
 */

public class WorkBriefActivity extends BaseActivity {
    @BindView(R.id.tvTitle)
    TextView tvTitle;
    @BindView(R.id.tvRight)
    TextView tvRight;
    @BindView(R.id.et_experience)
    EditText etExperience;
    @Request
    UserRestUsage userRestUsage = null;
    private int updateBriefId = 11;
    private String string;

    @Override
    protected int getLayoutResID() {
        return R.layout.activity_work_brief;
    }

    @Override
    public void initUI() {
        super.initUI();
        tvRight.setVisibility(View.VISIBLE);
        tvTitle.setText("公司简介");
        tvRight.setText("保存");
    }


    @Override
    public void refreshUI(int taskId, MSG msg) {
        super.refreshUI(taskId, msg);
        if (taskId == updateBriefId) {
            if (msg.getData()) {
                Intent intent = new Intent();
                intent.putExtra("cdesc", string);
                setResult(RESULT_OK, intent);
                finish();
            }
        }
    }

    @OnClick(R.id.tvRight)
    public void saveExperience(View view) {
        string = etExperience.getText().toString().trim();
        Map<String, String> prams = new HashMap<>();
        prams.put("cdesc", string);
        userRestUsage.updateUserInfo(updateBriefId, prams);
    }
}
